Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

object.fromentries

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object.fromentries

ES proposal-spec-compliant Object.fromEntries shim.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24M
decreased by-4.15%
Maintainers
1
Weekly downloads
 
Created

What is object.fromentries?

The object.fromentries npm package is a polyfill for the Object.fromEntries() method, which transforms a list of key-value pairs into an object. This is particularly useful for converting Map objects or arrays of arrays into object literals, allowing for easy manipulation and access of data structures.

What are object.fromentries's main functionalities?

Converting Map to Object

This feature allows for the conversion of Map objects to plain objects, making it easier to work with and access data stored in Maps.

const map = new Map([['foo', 'bar'], ['baz', 42]]);
const obj = Object.fromEntries(map);
console.log(obj); // Output: { foo: 'bar', baz: 42 }

Converting Array of Arrays to Object

This feature enables the transformation of an array of arrays (each inner array representing a key-value pair) into an object, simplifying the process of creating objects from structured data arrays.

const entries = [['foo', 'bar'], ['baz', 42]];
const obj = Object.fromEntries(entries);
console.log(obj); // Output: { foo: 'bar', baz: 42 }

Other packages similar to object.fromentries

Keywords

FAQs

Package last updated on 04 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc